package faction.quickSort;

import java.util.stream.IntStream;
import java.awt.AWTException;
import java.awt.Robot;
import java.awt.event.InputEvent;
public class QuickSort1 {

    public static void exec(int[] arr, int low, int high) {
        if (low < high) {
        int f = partion(arr, low, high);
        exec(arr, low, f - 1);
        exec(arr, f + 1, high);
        }
    }

    public static int partion(int[] arr, int low, int high) {
        int f1 = low;
        int value1 = arr[high];
        for (;low < high; low++) {
            if (arr[low] < value1) {
                int temp = arr[f1];
                arr[f1] = arr[low];
                arr[low] = temp;
                f1++;
            }
        }
        arr[high] = arr[f1];
        arr[f1] = value1;
        return f1;
    }

    public static void main(String[] args) {
        //  int[] arr = {16, 1, 12, 18, 11, 13, 2, 2, 5, 6};
        //  exec(arr, 0, arr.length - 1);
        // IntStream of = IntStream.of(arr);
        // of.forEach(c -> System.out.printf("%s ", c));
    }
}
